@import "variables.less";
@import "mixins.less";

.form-grid {
	border: 1px solid @border-color;
	border-radius: 3px;
}

.form-grid.error {
	border-color: @indicator-red;
}

.grid-heading-row {
	border-bottom: 1px solid @border-color;
	background-color: @panel-bg;
	font-weight: bold;
}

.grid-row {
	padding: 0px 15px;
	border-bottom: 1px solid @border-color;
	.transition(.2s);
}

.grid-row:last-child {
	border: none;
}

.rows .grid-row .data-row, .rows .grid-row .grid-footer-toolbar, .grid-form-heading {
	cursor: pointer;
}

.data-row textarea {
	height: 40px;
}

.grid-body {
	background-color: #fff;
}

.form-grid .data-row {
	// padding: 10px 15px;

	&.highlight {
		background-color: @extra-light-yellow;
	}

	&.sortable-handle {
		cursor: move;
	}
}

// hide row index in 6 column child tables
.form-column.col-sm-6 .form-grid .row-index > span {
	display: none;
}

.form-grid .template-row {
	padding: 8px 15px;
}

.grid-body .data-row {
	font-size: 12px;
}

.grid-empty, .list-loading {
	padding: 10px 15px;
	color: @border-color;
}

.grid-static-col, .row-index {
	height: 39px;
	padding: 10px 15px;
	max-height: 200px;
	border-right: 1px solid @border-color;
}

.editable-form .grid-static-col.bold {
	font-weight: bold;
	background-color: @extra-light-yellow;
}

.validated-form .grid-static-col.error {
	background-color: @label-danger-bg;
}

.grid-static-col {
	input[type="checkbox"] {
		margin-left: -16px !important;
	}
}

.row-index {
	text-align: right;
}

.grid-row > .row {
	.col:last-child {
		margin-right: -10px;
	}

	.col {
		padding-left: 10px;
		padding-right: 10px;
		// overflow: hidden;
	}
}

.grid-body {
	.btn-open-row {
		padding-top: 5px;
	}

	.editable-row {
		.grid-static-col {
			padding: 0px !important;
		}

		.checkbox {
			margin: 0px;
			text-align: center;
			margin-top: 9px;
		}

		textarea {
			height: 38px !important;
		}

		.form-control {
			border-radius: 0px;
			border: 0px;
			padding-top: 8px;
			padding-bottom: 9px;
			height: 38px;
		}

		.link-btn {
			top: 8px;
		}

		.form-control:focus {
			border-color: @text-muted;
			z-index: 2;
		}

		.has-error .form-control {
			z-index: 1;
			&:focus {
				border-color: @indicator-red;
			}
		}

		input[data-fieldtype="Int"], input[data-fieldtype="Float"], input[data-fieldtype="Currency"] {
			text-align: right;
		}
	}

	.grid-static-col[data-fieldtype="Button"] .field-area {
		margin-top: 5px;
		margin-left: 5px;

		button {
			height: 27px;
		}
	}

	.grid-static-col[data-fieldtype="Code"] {
		overflow: hidden;

		.static-area {
			margin-top: -5px;

			pre {
				background: none;
				border: none;
			}
		}
	}

	.grid-static-col[data-fieldtype="Text Editor"] {
		overflow: hidden;
	}

}

@media (max-width: 767px) {
	.grid-body {
		.btn-open-row {
			margin-top: 0px;
			padding: 0px;
		}
	}

	// lesser padding for controls
	.editable-row .frappe-control {
		padding-top: 0px !important;
		padding-bottom: 0px !important;
		margin-left: -5px !important;
		margin-right: -5px !important;
	}
}

.row-data > .row {
	margin-left: 15px;
}

.grid-row {
	td {
		vertical-align: top;
	}

	p {
		margin-bottom: 5px;
	}

	.frappe-control {
		margin-bottom: 0px;
		position: relative;
	}

	.col-sm-6 {
		.editor-toolbar-text-group,
		.editor-toolbar-align-group {
			display: none;
		}

		.text-editor {
			height: 200px;
		}

		.markdown-text-editor {
			height: 251px;
		}
	}
}

.form-in-grid {
	background-color: white;
	z-index: 1021;
	position: relative;
	overflow: hidden;
	height: 0;
	opacity: 0;
	.transition(opacity .2s ease)
}

.grid-row-open .form-in-grid {
	opacity: 1;
	height: auto;
	overflow: visible;
	margin: 0px -15px;
}

.grid-form-heading {
	padding: 10px 15px;
	font-size: 120%;
	border-bottom: 1px solid @border-color;
}

.grid-footer {
	background-color: #fff;
}

.grid-footer-toolbar {
	padding: 10px 15px;
	border-top: 1px solid @border-color;
}

.grid-overflow-no-ellipsis {
	word-wrap: break-word;
	overflow: hidden;
	padding-right: 0px;
}

.grid-overflow-ellipsis {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding-right: 0px;
}

.grid-label {
	margin-right: 8px; margin-bottom: 4px;
}

